package com.example.neusoft.yuejian.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.neusoft.yuejian.Base.BaseActivity;
import com.example.neusoft.yuejian.Bean.exercisesbean;
import com.example.neusoft.yuejian.R;
import com.squareup.picasso.Picasso;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ExerciseDetailActivity extends BaseActivity implements View.OnClickListener {
    private exercisesbean exer;
    private TextView tx_den,tx_dej,tx_time,tx_desp;
    private ImageView img_de;
    private Button bt_attend;

    @Override
    public int getLayoutFile() {
        return R.layout.activity_exercisedetail;


    }

    @Override
    public void initView() {
            tx_den=findViewById(R.id.tx_den);
            tx_dej=findViewById(R.id.tx_dej);
            tx_time=findViewById(R.id.tx_time);
            tx_desp=findViewById(R.id.tx_desp);
            img_de=findViewById(R.id.img_de);
            bt_attend=findViewById(R.id.bt_attend);


    }

    @Override
    public void initEvent() {
            bt_attend.setOnClickListener(this);
    }

    @Override
    public void initData() {
            exer=(exercisesbean)getIntent().getSerializableExtra("exerlist");
            tx_den.setText(exer.getExername());
            tx_dej.setText(exer.getExerintro());
            tx_desp.setText(exer.getExeraddress());
            tx_time.setText(exer.getExerstarttime());
        Picasso.with(this).load("http://172.19.187.195/YueJian/public/static/img/exerimg/"+exer.getExerpic()).into(img_de);


    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_attend:
                Intent intent=new Intent(this, ExernrollActivity.class);
                Bundle bundle=new Bundle();
                bundle.putSerializable("exer",exer);
                intent.putExtras(bundle);
                startActivity(intent);
                break;
        }
    }
}
